<?php
		include "pdfcrowd.php";
		//$client = new Pdfcrowd("trantung8111", "970c8ea4ac0e157e01a8a316c8ac7698");
		//$client = new Pdfcrowd("ngheweb_vn", "7427840b54f8a5ed52994af51f0ff644");
		$client = new Pdfcrowd("dttlinh", "3a3008b69f02c3c70294b0c9ebd61ddb");
		
		if($_GET["type"] == "baocaokq")
		{
			$link = 'http://localhost/luanvan/dbcl-baocaokq.php?ma='.$_GET["ma"].'&makhoa='.$_GET["makhoa"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "gvinketqua")
		{
			//$link = 'http://localhost/luanvan/dbcl-baocaokq.php?ma='.$_GET["ma"].'&makhoa='.$_GET["makhoa"]."&act=in";
			$link = 'http://localhost/luanvan/gv-inketqua.php?magv='.$_GET["magv"].'&ma='.$_GET["ma"].'&nhom='.$_GET["nhom"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "gvsskqhp")
		{
			
			$link = 'http://localhost/luanvan/gv-sskqhp.php?magv='.$_GET["magv"].'&ma='.$_GET["ma"].'&mahp='.$_GET["mahp"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "gvsskqlophp")
		{
			
			$link = 'http://localhost/luanvan/gv-sskqlophp.php?magv='.$_GET["magv"].'&ma1='.$_GET["ma1"].'&mahp='.$_GET["mahp"].'&ma2='.$_GET["ma2"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "gvintatca")
		{
			
			$link = 'http://localhost/luanvan/gv-intatca.php?magv='.$_GET["magv"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnktheodoi")
		{
			
			$link = 'http://localhost/luanvan/cnk-theodoikq.php?cnk='.$_GET["cnk"].'&ma='.$_GET["ma"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkinlophp")
		{
			
			$link = 'http://localhost/luanvan/cnk-inlophp.php?ma='.$_GET["ma"].'&nhom='.$_GET["nhom"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkinhp")
		{
			
			$link = 'http://localhost/luanvan/cnk-inhp.php?ma='.$_GET["ma"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkintatcahp")
		{
			
			$link = 'http://localhost/luanvan/cnk-intatcahp.php?cnk='.$_GET["cnk"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkingv")
		{
			
			$link = 'http://localhost/luanvan/cnk-ingv.php?ma='.$_GET["ma"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkinbomon")
		{
			
			$link = 'http://localhost/luanvan/cnk-inbomon.php?ma='.$_GET["ma"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnkinbomontc")
		{
			
			$link = 'http://localhost/luanvan/cnk-inbomontc.php?cnk='.$_GET["cnk"].'&hk='.$_GET["hk"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnktoankhoa")
		{
			
			$link = 'http://localhost/luanvan/cnk-kqtoankhoabc.php?cnk='.$_GET["cnk"].'&ma='.$_GET["ma"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnksskqhp")
		{
			
			$link = 'http://localhost/luanvan/cnk-sskqhp.php?cnk='.$_GET["cnk"].'&ma='.$_GET["ma"].'&mahp='.$_GET["mahp"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "cnksskqlophp")
		{
			
			$link = 'http://localhost/luanvan/cnk-sskqlophp.php?cnk='.$_GET["cnk"].'&ma1='.$_GET["ma1"].'&mahp='.$_GET["mahp"].'&ma2='.$_GET["ma2"].'&magv='.$_GET["magv"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "dbcltheodoi")
		{
			
			$link = 'http://localhost/luanvan/dbcl-intheodoi.php?ma='.$_GET["ma"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		if($_GET["type"] == "thongkekq")
		{
			
			$link = 'http://localhost/luanvan/dbcl-thongkekq.php?ma='.$_GET["ma"].'&makhoa='.$_GET["makhoa"]."&act=in";
			$f = fopen($link, "rb");
			$contents = '';
			while (!feof($f)) {
			$contents .= fread($f, 8192);
			}
			fclose($f);
		}
		//echo $contents;
		$pdf = $client->convertHtml($contents);
		ob_start();
		header("Content-Type: application/pdf");
		header("Accept-Ranges: none");
		header("Content-Disposition: attachment; filename=\"baocao.pdf\"");
		ob_end_flush();
		echo $pdf;
?>